package com.bblocks.enums;

import com.bblocks.exception.ServiceException;

/**
 * <p>Project: bblocks-pro - CodeTypeEnum</p>
 * <p>描述：短信验方式枚举</p>
 *
 * @Author Zhao [125043150@qq.com]
 * @Date 2023/9/15 10:26
 * @Version 1.0
 * @since 8
 */
public enum CodeTypeEnum {
    CodePub(0, "注册/登录");

    private Integer type;
    private String name;
    private static CodeTypeEnum[] all = values();

    private CodeTypeEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public String toString() {
        return this.type + ":" + this.name;
    }

    public static CodeTypeEnum getCodeTypeEnum(Integer type) {
        if (type == null) {
            return null;
        } else {
            CodeTypeEnum[] var1 = all;
            int var2 = var1.length;

            for(int var3 = 0; var3 < var2; ++var3) {
                CodeTypeEnum c = var1[var3];
                if (c.getType().equals(type)) {
                    return c;
                }
            }

            throw new ServiceException("无此类型：" + type);
        }
    }

    public Integer getType() {
        return this.type;
    }

    public String getName() {
        return this.name;
    }
}